﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using HPT.Utilities;

namespace HPT
{
    [Serializable]
    public class NewsModal : SPItem
    {
        public string Contents { get; set; }
        public bool Publish { get; set; }
        public string Url { get; set; }
        public int DisplayOrder { get; set; }
        public int HitCounter { get; set; }


        public NewsModal(SPListItem item)
        {
            Id = item.ID;
            Title = item.Title;
            Contents = OConvert.GetShortDetail(OConvert.ToString(item["Contents"]), 200);
            Publish = OConvert.ToBoolean(item["Publish"]);
            Url = OConvert.ToString(item["Url"]).Split(',')[0];
            //if (!String.IsNullOrEmpty(Url))
            //{
            //    Url = OConvert.GetFirstImage(Contents);
            //}
            DisplayOrder = OConvert.ToInt(item["DisplayOrder"]);
            HitCounter = OConvert.ToInt(item["HitCounter"]);

        }
        public NewsModal()
        {
        }
    }
}
